import React, { useEffect, useState } from 'react'
import Swiper from 'swiper'
import 'swiper/css/swiper.min.css'
import './TopBar.css'

const TopBar = (props) => {
    const { index ,setIndex } = props
    // console.log(props,'555555');
    // useEffect(() => {
    //     setTimeout(() => {
    //         new Swiper('.swiper-container', {
    //             loop: true,
    //             autoplay:{
    //                 delay: 1000
    //             },
    //             pagination: {
    //                 el: '.swiper-pagination',
    //                 type: 'bullets',
    //                 clickable: true
    //             }
    //         })
    //     }, 100)
    // }, [])
// let [index,setIndex] = useState(0);
// console.log(index,'top');
    return (
        <div className="topBar">
            <div className="section">
                <div className={`option ${index ==0 ? "active": "" }`} onClick={setIndex.bind(this,0)}>
                    推荐
                </div>
                <div className={`option ${index ==1 ? "active": "" } option2`} onClick={setIndex.bind(this,1)}>
                    歌手
                </div>
                <div className={`option ${index ==2 ? "active": "" }`} onClick={setIndex.bind(this,2)}>
                    电台
                </div>
                <div className={`option ${index ==3 ? "active option4": "" }`} onClick={setIndex.bind(this,3)}>
                    听书
                </div>
            </div>
            
        </div>
    )
}

export default TopBar